import os.path
import time
from selenium.webdriver.common.by import By
from selenium import webdriver

# 实例化配置项
options = webdriver.ChromeOptions()

# 准备配置项
download = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'download')
prefs = {
    'profile.default_content_settings.popups': 0,
    'download.default_directory': download
}
# 添加参数
options.add_experimental_option('prefs', prefs)

# 打开浏览器
driver = webdriver.Chrome(options=options)  # 注意传入配置选项对象
driver.get('https://browser.qq.com/sem/sem051/index.html')
driver.maximize_window()
time.sleep(3)

# 点击下载
driver.find_element(By.ID, 'download').click()

time.sleep(60)
driver.quit()
